<template>
    <div class="content">
        <div class="top-box">
            <div class="logo-box">
                <div class="logo">
                    <img src="@/assets/ui/ui-logo-withe.png" alt="">
                    <span></span>
                </div>
                <div class="zixun">
                    <div class="p1">咨询服务电话：</div>
                    <div class="p2">电话1：{{ webMessage.tel1 }}</div>
                    <div class="p2">电话2：{{ webMessage.tel2 }}</div>
                    <div class="p3">邮箱：{{ webMessage.email }}</div>
                    <div class="p3">地址：{{ webMessage.dizhi }}</div>

                </div>
            </div>
            <div class="daohang-box">
                <div class="title">
                    快捷导航
                </div>
                <span></span>
                <div class="item-box">
                    <div class="p4" v-for="(item, index) in routerJson" :key="index" @click="gotoweb(item.path)">
                        {{ '>' + ' ' + item.title }}
                    </div>
                </div>
            </div>
            <div class="xilie-box">
                <div class="title">
                    产品系列
                </div>
                <span></span>
                <div class="item-box">
                    <div class="p4" v-for="(item, index) in bottomList" :key="index" @click="gotoChanpin(item.record_id
                    )">
                        {{ '>' + ' ' + item.title }}
                    </div>
                </div>
            </div>
            <div class="about-box">
                <div class="title">
                    联系我们
                </div>
                <span></span>
                <img v-if="webMessage.weixinimg" :src="base64Img(webMessage.weixinimg)" alt="">
            </div>

        </div>
        <div class="bottom-bar">
            <div class="box">
                <div class="left">Copyright © 2024 山东四度制冷科技有限公司 All Rights Reserved</div>
                <div class="right">
                    <a href="https://beian.miit.gov.cn/">{{ webMessage.beian }}</a>
                </div>
            </div>

        </div>
    </div>
</template>

<script setup>
import router from '@/router/index.js'
import { getTopList, getWebXinxi } from '@/api/viewapi.js'
import { ref, reactive, onMounted } from 'vue'
import { base64Img } from '@/tools/tools.js'
const bottomList = ref([])
const webMessage = ref({})
const routerJson = [
    {
        title: '网站首页',
        path: '/'
    }, {
        title: '关于我们',
        path: '/about'
    }, {
        title: '新闻中心',
        path: '/news'
    }, {
        title: '联系我们',
        path: '/telme'
    }
]


const gotoweb = (path) => {
    router.push(path)
}

const getWebMessage = () => {
    getWebXinxi('1').then((res) => {
        webMessage.value = res.data.data
        console.log(res);
    })
}

const _getTopList = () => {
    getTopList().then((res) => {
        bottomList.value = res.data.toplist_ids
        console.log(res);
    })
}

// 跳转商品列表 
const gotoChanpin = (id) => {
    router.push({ path: '/chanpinlist', query: { id: id } })
}



onMounted(() => {
    getWebMessage()
    _getTopList()
})


</script>

<style lang="scss" scoped>
// 取消显示手机端 显示pc端
@media (min-width: 800px) {
    .content {
        background-color: #002b53;
        color: white;

        .top-box {
            padding: 40px;
            max-width: 1400px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;

            span {
                margin-top: 20px;
                display: block;
                width: 160px;
                height: 1px;
                background-color: white;
            }

            .logo-box {
                .logo {
                    img {
                        width: 180px;
                    }
                }

                .zixun {
                    margin-top: 20px;

                    .p1 {
                        font-size: 18px;

                    }

                    .p2 {
                        padding: 4px 0;
                        font-size: 24px;
                    }

                    .p3 {
                        padding: 4px 0;
                    }
                }
            }

            .title {
                font-size: 28px;
                padding-bottom: 20px;
            }

            .daohang-box {

                .item-box {
                    width: 300px;
                    margin-top: 20px;
                    display: grid;
                    font-size: 14px;
                    grid-template-columns: repeat(2, 1fr);
                    gap: 10px;
                    cursor: pointer;
                    font-weight: 700;
                }
            }

            .xilie-box {

                .item-box {
                    width: 300px;
                    margin-top: 20px;
                    display: grid;
                    font-size: 14px;
                    grid-template-columns: repeat(2, 1fr);
                    gap: 10px;
                    cursor: pointer;
                    font-weight: 700;
                }
            }

            .about-box {
                img {
                    margin-top: 20px;
                    width: 200px;
                }
            }

        }

        .bottom-bar {
            background-color: #252525;


            .box {
                line-height: 40px;
                display: flex;
                justify-content: space-around;
                margin: 0 auto;
                max-width: 1400px;
                color: white;

                a {
                    color: white;
                    text-decoration: none;
                }
            }
        }
    }
}

// 取消显示pc端 显示手机端
@media screen and (max-width: 799px) {
    .content {
        color: white;
        padding: 20px 10px;
        background-color: #33abda;

        .item-box {
            .p4 {
                height: 40px;
            }
        }

        .top-box {
            .logo-box{
                .logo {
                    display: none;
                }
                .zixun {
                    display: flex;
                    flex-direction: column;
                    div {
                        padding: 4px 0;
                        color: white;
                    }
                }
            }
            .daohang-box {
                margin-top: 10px;
                .title {
                    font-size: 20px;
                    color: white;
                }
                span {
                    margin-top: 14px;
                    margin-bottom: 14px;

                    display: block;
                    height: 1px;
                    width: 100%;
                    background-color: white;
                }
            }

            .xilie-box {
                margin-top: 10px;
                .title {
                    font-size: 20px;
                    color: white;
                }
                span {
                    margin-top: 14px;
                    margin-bottom: 14px;

                    display: block;
                    height: 1px;
                    width: 100%;
                    background-color: white;
                }
            }

            .about-box {
                display: none;
            }
        }
        .bottom-bar {

            margin-top: 24px;
            width: 100%;
            text-align: center;
        }
    }
}
</style>